package com.ethan.cj.ssm.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 *人员实体类
 */
@Getter
@Setter
@ToString
@NoArgsConstructor

public class People {
  private int pId;//主键id
  @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
  private Date addTime;//添加时间
  private String pname;//用户名
  private String password;//密码
  private String realname;//真实姓名
  private String phonenum;//手机号
  private String email;//email邮箱

  @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
  private Date lastLoginTime;//最后登陆时间
  private long loginNum;//登录次数
  private String lastLoginIp;//最后一次登录IP
  private Mechanism mechanism;//所属机构
  private Role role;//角色
  private Dept dept;//部门
  private int mid;
  private int did;
  private int rid;
  private int status;//状态0冻结，1激活
  private String statusName;

  public People(Date addTime, String pname, String password, String realname, String phonenum, String email, Date lastLoginTime, long loginNum, String lastLoginIp, Mechanism mechanism, Role role, Dept dept, int status) {
    this.addTime = addTime;
    this.pname = pname;
    this.password = password;
    this.realname = realname;
    this.phonenum = phonenum;
    this.email = email;
    this.lastLoginTime = lastLoginTime;
    this.loginNum = loginNum;
    this.lastLoginIp = lastLoginIp;
    this.mechanism = mechanism;
    this.role = role;
    this.dept = dept;
    this.status = status;
  }

  public People(int pId, Date addTime, String pname, String password, String realname, String phonenum, String email, Date lastLoginTime, long loginNum, String lastLoginIp, Mechanism mechanism, Role role, Dept dept, int mid, int did, int rid, int status, String statusName) {
    this.pId = pId;
    this.addTime = addTime;
    this.pname = pname;
    this.password = password;
    this.realname = realname;
    this.phonenum = phonenum;
    this.email = email;
    this.lastLoginTime = lastLoginTime;
    this.loginNum = loginNum;
    this.lastLoginIp = lastLoginIp;
    this.mechanism = mechanism;
    this.role = role;
    this.dept = dept;
    this.mid = mid;
    this.did = did;
    this.rid = rid;
    this.status = status;
    this.statusName = statusName;
  }

  public String getStatusName() {

    if(status==1){
      statusName="激活";
    }else {
      statusName="冻结";
    }
    return statusName;
  }
}
